package com.bfly.mall.product.dto;

import com.bfly.mall.product.enums.PricingMethodEnum;
import com.bfly.mall.product.enums.ShippingMethodEnum;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 运费模板包邮条件列表DTO
 *
 * @author 长沙商脉科技有限公司
 * @date 2020/4/27 10:49
 */
public class FreightFreeConditionListDTO implements Serializable {

    private static final long serialVersionUID = 8037763132014723348L;

    private int shippingMethod;
    private int pricingMethod;
    private String cityNames;
    private int pieces;
    private BigDecimal weights;
    private BigDecimal volumes;
    private BigDecimal prices;

    public String getShippingMethodName() {
        ShippingMethodEnum methodEnum = ShippingMethodEnum.getShippingMethod(getShippingMethod());
        return methodEnum == null ? "" : methodEnum.getName();
    }

    public String getUnit() {
        PricingMethodEnum methodEnum = PricingMethodEnum.getPricingMethod(getPricingMethod());
        if(methodEnum!=null) {
            switch (methodEnum) {
                case PIECE:
                    return "件";
                case MONEY:
                    return "元";
                case WEIGHT:
                    return "KG";
                case VOLUME:
                    return "m³";
                case PIECE_MONEY:
                    return "件";
                default:
                    return "";
            }
        }
        return "";
    }

    public int getShippingMethod() {
        return shippingMethod;
    }

    public void setShippingMethod(int shippingMethod) {
        this.shippingMethod = shippingMethod;
    }

    public String getCityNames() {
        return cityNames;
    }

    public void setCityNames(String cityNames) {
        this.cityNames = cityNames;
    }

    public int getPricingMethod() {
        return pricingMethod;
    }

    public void setPricingMethod(int pricingMethod) {
        this.pricingMethod = pricingMethod;
    }

    public int getPieces() {
        return pieces;
    }

    public void setPieces(int pieces) {
        this.pieces = pieces;
    }

    public BigDecimal getWeights() {
        return weights;
    }

    public void setWeights(BigDecimal weights) {
        this.weights = weights;
    }

    public BigDecimal getVolumes() {
        return volumes;
    }

    public void setVolumes(BigDecimal volumes) {
        this.volumes = volumes;
    }

    public BigDecimal getPrices() {
        return prices;
    }

    public void setPrices(BigDecimal prices) {
        this.prices = prices;
    }
}
